<?php

/**
 * class purchaseOrderDetail
 *
 * Description for class purchaseOrderDetail
 *
 * @author:
*/
Zend_Loader::loadClass("CodesUtility");
Zend_Loader::loadClass("BaseDBRow");
class purchaseOrderDetail extends BaseDBRow {

	const _tablename = "projecte_sales.order_details";
	protected function setUp()
	{
		$this->_tableName = self::_tablename;		
	}
	
	public function getpodetailId($po_no,$orgid,$param){
	
		Zend_Loader::loadClass("purchaseOrder");
		Zend_Loader::loadClass("QueryCreator");
		
		$query = new QueryCreator();
		$query->addSelect(" po_detail_id ");
		$query->addFrom(purchaseOrder::_tablename . " a ");
		$query->addJoin("left join ". $this->_tableName . " b on a.po_id = b.po_id ");
		$query->addWhere(" a.po_no = '". $po_no ."' and a.org_id = ".$org_id );
		$query->addWhere(" supplier_org_id = ". $param[3] . " and fishing_area_id = ". $param[6]. " and org_organism_id = ". $param[7] . " and size_code = ". $param[11]);
		
		$db = DBCon::instance();
		$result = $db->executeQuery($query->createSQL());
		
		return $result[0]['po_detail_id'];
		
	
	}

}
?>